package com.ruoyi.jetLinks.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.jetLinks.domain.NmEquipemntRecord;
import com.ruoyi.jetLinks.service.INmEquipemntRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 设备维护信息Controller
 * 
 * @author lxx
 * @date 2021-12-27
 */
@Api(tags = "设备维护信息")
@RestController
@RequestMapping("/jetLinks/nmEquipemntRecord")
public class NmEquipemntRecordController extends BaseController {
    @Autowired
    private INmEquipemntRecordService nmEquipemntRecordService;

    /**
     * 查询设备维护信息列表
     */
    @ApiOperation("查询设备维护信息列表")
    @PreAuthorize("@ss.hasPermi('jetLinks:nmEquipemntRecord:list')")
    @GetMapping("/list")
    public TableDataInfo list(NmEquipemntRecord nmEquipemntRecord) {
        startPage();
        List<NmEquipemntRecord> list = nmEquipemntRecordService.selectNmEquipemntRecordList(nmEquipemntRecord);
        return getDataTable(list);
    }

    /**
     * 导出设备维护信息列表
     */
    @ApiOperation("导出设备维护信息列表")
    @PreAuthorize("@ss.hasPermi('jetLinks:nmEquipemntRecord:export')")
    @Log(title = "设备维护信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(NmEquipemntRecord nmEquipemntRecord) {
        List<NmEquipemntRecord> list = nmEquipemntRecordService.selectNmEquipemntRecordList(nmEquipemntRecord);
        ExcelUtil<NmEquipemntRecord> util = new ExcelUtil<NmEquipemntRecord>(NmEquipemntRecord.class);
        return util.exportExcel(list, "设备维护信息数据");
    }

    /**
     * 获取设备维护信息详细信息
     */
    @ApiOperation("获取设备维护信息详细信息")
    @PreAuthorize("@ss.hasPermi('jetLinks:nmEquipemntRecord:query')")
    @GetMapping(value = "/{recodId}")
    public AjaxResult getInfo(@PathVariable("recodId") Long recodId) {
        return AjaxResult.success(nmEquipemntRecordService.selectNmEquipemntRecordById(recodId));
    }

    /**
     * 新增设备维护信息
     */
    @ApiOperation("新增设备维护信息")
    @PreAuthorize("@ss.hasPermi('jetLinks:nmEquipemntRecord:add')")
    @Log(title = "设备维护信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody NmEquipemntRecord nmEquipemntRecord) {
        return toAjax(nmEquipemntRecordService.insertNmEquipemntRecord(nmEquipemntRecord));
    }

    /**
     * 修改设备维护信息
     */
    @PreAuthorize("@ss.hasPermi('jetLinks:nmEquipemntRecord:edit')")
    @Log(title = "设备维护信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody NmEquipemntRecord nmEquipemntRecord) {
        return toAjax(nmEquipemntRecordService.updateNmEquipemntRecord(nmEquipemntRecord));
    }

    /**
     * 删除设备维护信息
     */
    @ApiOperation("删除设备维护信息")
    @PreAuthorize("@ss.hasPermi('jetLinks:nmEquipemntRecord:remove')")
    @Log(title = "设备维护信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{recodIds}")
    public AjaxResult remove(@PathVariable Long[] recodIds) {
        return toAjax(nmEquipemntRecordService.deleteNmEquipemntRecordByIds(recodIds));
    }
}
